package com.qqtech.qquan.mall.dao;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import com.qqtech.core.frame.dao.BaseDaoImpl;
import com.qqtech.qquan.mall.model.MallProductSpec;

@Repository
public class MallProductSpecDaoImpl extends BaseDaoImpl<MallProductSpec> implements MallProductSpecDao {
	public static final Logger log = LoggerFactory.getLogger(MallProductSpecDaoImpl.class);

	@Override
	public int reduceStock(int specId, int quantity) {
		MallProductSpec spec = new MallProductSpec();
		spec.setId(specId);
		spec.setStock(quantity);
        return sqlSessionTemplate.update(getSqlName("reduceStock"), spec);
	}

	@Override
	public int addStock(int specId, int quantity) {
		MallProductSpec spec = new MallProductSpec();
		spec.setId(specId);
		spec.setStock(quantity);
        return sqlSessionTemplate.update(getSqlName("addStock"), spec);
	}
	
}
